From 8627dcc084e9f84eaad8ec4723d86186440df8dd Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Thu, 10 Mar 2011 18:21:42 +0000 Subject: [PATCH] libxl: do not rely on guest to respond when forcing pci device removal This is consistent with the expected semantics of a forced device removal and also avoids a delay when destroying an HVM domain which either does not support hot unplug (does not respond to SCI) or has crashed. Signed-off-by: Ian Campbell Committed-by: Ian Jackson --- tools/libxl/libxl_pci.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c index 56ec063888..5860116cd1 100644 --- a/tools/libxl/libxl_pci.c +++ b/tools/libxl/libxl_pci.c @@ -865,7 +865,7 @@ static int do_pci_remove(libxl__gc *gc, uint32_t domid, /* Remove all functions at once atomically by only signalling * device-model for function 0 */ - if ( (pcidev->vdevfn & 0x7) == 0 ) { + if ( !force && (pcidev->vdevfn & 0x7) == 0 ) { xs_write(ctx->xsh, XBT_NULL, path, "pci-rem", strlen("pci-rem")); if (libxl__wait_for_device_model(ctx, domid, "pci-removed", NULL, NULL) < 0) { LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Device Model didn't respond in time"); @@ -873,8 +873,7 @@ static int do_pci_remove(libxl__gc *gc, uint32_t domid, * SCI, if it doesn't respond in time then we may wish to * force the removal. */ - if ( !force ) - return ERROR_FAIL; + return ERROR_FAIL; } } path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/state", domid); -- 2.30.2